{extend name="common/layout"}

{block name="body_tag_class"}{/block}

{block name="main"}
<form class="layui-form" action="">
	<div class="mainBox">
		<div class="main-container">

			
			<div class="layui-form-item">
				<label class="layui-form-label">新密码</label>
				<div class="layui-input-block">
					<input type="text" name="password" lay-verify="required"  autocomplete="off"
					class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">确认新密码</label>
				<div class="layui-input-block">
					<input type="text" name="confirm_password" lay-verify="required"  autocomplete="off"
					class="layui-input">
				</div>
			</div>
			
		</div>
	</div>
	<div class="bottom">
		<div class="button-container">
			<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
					lay-filter="user-save">
				<i class="layui-icon layui-icon-ok"></i>
				提交
			</button>
			<button type="reset" class="pear-btn pear-btn-sm">
				<i class="layui-icon layui-icon-refresh"></i>
				重置
			</button>
		</div>
	</div>
</form>
{/block}

{block name="footer_script"}
<script>
	layui.use(['form', 'jquery'], function() {
		let form = layui.form;
		let $ = layui.jquery;

		form.on('submit(user-save)', function(data) {

			$.ajax({
				url: '/admin/admin/pwdPost',
				data: data.field,
				dataType: 'json',
				type: 'post',
				success: function(result) {
					if (result.code == 1) {
						layer.msg(result.msg, {
							icon: 1,
							time: 1000
						}, function() {
							//刷新整体页面，重新登录
							window.parent.location.reload();
							// parent.layer.close(parent.layer.getFrameIndex(window
							// 		.name)); //关闭当前页
						});
					} else {
						layer.msg(result.msg, {
							icon: 2,
							time: 1000
						});
					}
				}
			})
			return false;
		});
	})
</script>
{/block}
